package com.htl.io.缓冲流;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;

/**
 *  字符输出缓冲流 BufferedWriter
 */

public class BufferedWriter__test {
    public static void main(String[] args) {
        Writer writer = null;
        BufferedWriter bufferedWriter = null;
        try {
            writer = new FileWriter("D:\\Project\\IDEA_project\\java_note\\src\\com\\htl\\io\\缓冲流\\demo.txt");
            bufferedWriter = new BufferedWriter(writer);
            String str = "使用了【字符输出缓冲流】 BufferedWriter";
            bufferedWriter.write(str);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                bufferedWriter.flush();
                bufferedWriter.close();
                writer.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}
